<%
layout("/include/_container.html", {title:"外部邮件", parent:"常用工具"}){
%>
<div class="white-box">
    <div class="row">

        <div class="col-sm-12">
            <div class="mail-box-header">
                <div class="pull-right tooltip-demo">
                    <button type="button" class="btn btn-sm btn-custom waves-effect waves-light w-xs m-b-5" onclick="sendLetter()"><i
                            class="fa fa-pencil"></i> 发送邮件
                    </button>
                </div>
                <h2>
                    写邮件
                </h2>
            </div>

            <div class="mail-box">


                <div class="mail-body">
                    <form id="inputForm" action="${ctx}/tools/email/send" method="post" class="form-horizontal">
                        <div class="form-group row">
                            <label class="col-sm-offset-3 col-sm-2 control-label"><font color="red">*</font>发送到：</label>

                            <div class="col-sm-8">
                                <input type="text" placeholder="输入多个邮件地址请用英文符号;隔开" id="emailAddress" name="emailAddress"
                                       class="form-control" value="">
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-sm-offset-2 col-sm-2 control-label">主题：</label>

                            <div class="col-sm-8">
                                <input type="text" id="title" name="title" class="form-control" value="">
                            </div>
                        </div>
                        <input type="hidden" id="content" name="content"><!-- 内容 -->
                    </form>
                </div>

                <div class="mail-text h-200">

                    <div class="summernote">


                    </div>
                    <div class="clearfix"></div>
                </div>
                <div class="mail-body text-right tooltip-demo">

                    <button type="button" class="btn btn-sm btn-custom waves-effect waves-light w-xs m-b-5" onclick="sendLetter()"><i
                            class="fa fa-reply"></i> 发送
                    </button>
                </div>
                <div class="clearfix"></div>


            </div>

        </div>

    </div>
</div>
<script>
    $(document).ready(function () {
        //富文本初始化
        $('.summernote').summernote({
            height: 300,
            lang: 'zh-CN',
            focus: true
        });


    });

    function sendLetter() {
        if ($("#emailAddress").val() == '') {
            jp.alert('收件人不能为空！');
            return;
        }
        if ($("#title").val() == '') {
            jp.alert('标题不能为空！');
            return;
        }
        $("#content").val($('.summernote').summernote("code"));
        layer.msg("正在发送邮件...", {
            icon: 16
            ,shade: 0.01,
            time:999999999//设置超长时间
        });
        $("#inputForm").submit();
    }
</script>

<% } %>